﻿using Microsoft.AspNetCore.Mvc;
using SD.Infrastructure.DTOBase;
using SD.Toolkits.AspNetCore.Attributes;
using SlamDunk.MES.IAppService.DTOs.Inputs;
using SlamDunk.MES.IAppService.DTOs.Outputs.ResourceContext;
using SlamDunk.MES.IAppService.Interfaces;
using SlamDunk.ValueObjects.Enums;
using System;
using System.Collections.Generic;

namespace SlamDunk.MES.AppService.Host.Controllers
{
    /// <summary>
    /// 资源定义服务WebApi接口
    /// </summary>
    [ApiController]
    [Route("Api/[controller]/[action]")]
    public class ResourceController : ControllerBase
    {
        #region # 字段及构造器

        /// <summary>
        /// 基础定义服务契约接口
        /// </summary>
        private readonly IResourceContract _resourceContract;

        /// <summary>
        /// 依赖注入构造器
        /// </summary>
        public ResourceController(IResourceContract resourceContract)
        {
            this._resourceContract = resourceContract;
        }

        #endregion


        //命令部分

        #region # 创建人员类 —— void CreatePersonClass(Guid? parentNodeId, string classNo...
        /// <summary>
        /// 创建人员类
        /// </summary>
        /// <param name="parentNodeId">上级节点Id</param>
        /// <param name="classNo">人员类编号</param>
        /// <param name="className">人员类名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void CreatePersonClass(Guid? parentNodeId, string classNo, string className, Guid? facilityId, string description)
        {
            this._resourceContract.CreatePersonClass(parentNodeId, classNo, className, facilityId, description);
        }
        #endregion

        #region # 修改人员类 —— void UpdatePersonClass(Guid personClassId, string classNo...
        /// <summary>
        /// 修改人员类
        /// </summary>
        /// <param name="personClassId">人员类Id</param>
        /// <param name="classNo">人员类编号</param>
        /// <param name="className">人员类名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void UpdatePersonClass(Guid personClassId, string classNo, string className, Guid? facilityId, string description)
        {
            this._resourceContract.UpdatePersonClass(personClassId, classNo, className, facilityId, description);
        }
        #endregion

        #region # 删除人员类 —— void RemovePersonClass(Guid personClassId)
        /// <summary>
        /// 删除人员类
        /// </summary>
        /// <param name="personClassId">人员类Id</param>
        [HttpPost]
        [WrapPostParameters]
        public void RemovePersonClass(Guid personClassId)
        {
            this._resourceContract.RemovePersonClass(personClassId);
        }
        #endregion

        #region # 创建人员 —— void CreatePerson(string personNo, string personName...
        /// <summary>
        /// 创建人员
        /// </summary>
        /// <param name="personNo">人员编号</param>
        /// <param name="personName">人员姓名</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void CreatePerson(string personNo, string personName, Guid? facilityId, string description)
        {
            this._resourceContract.CreatePerson(personNo, personName, facilityId, description);
        }
        #endregion

        #region # 修改人员 —— void UpdatePerson(Guid personId, string personNo...
        /// <summary>
        /// 修改人员
        /// </summary>
        /// <param name="personId">人员Id</param>
        /// <param name="personNo">人员编号</param>
        /// <param name="personName">人员姓名</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void UpdatePerson(Guid personId, string personNo, string personName, Guid? facilityId, string description)
        {
            this._resourceContract.UpdatePerson(personId, personNo, personName, facilityId, description);
        }
        #endregion

        #region # 删除人员 —— void RemovePerson(Guid personId)
        /// <summary>
        /// 删除人员
        /// </summary>
        /// <param name="personId">人员Id</param>
        [HttpPost]
        [WrapPostParameters]
        public void RemovePerson(Guid personId)
        {
            this._resourceContract.RemovePerson(personId);
        }
        #endregion

        #region # 关联人员到人员类 —— void RelatePersonToClasses(Guid personId...
        /// <summary>
        /// 关联人员到人员类
        /// </summary>
        /// <param name="personId">人员Id</param>
        /// <param name="personClassIds">人员类Id集</param>
        [HttpPost]
        [WrapPostParameters]
        public void RelatePersonToClasses(Guid personId, IEnumerable<Guid> personClassIds)
        {
            this._resourceContract.RelatePersonToClasses(personId, personClassIds);
        }
        #endregion

        #region # 创建班组 —— void CreateTeam(string teamNo, string teamName...
        /// <summary>
        /// 创建班组
        /// </summary>
        /// <param name="teamNo">班组编号</param>
        /// <param name="teamName">班组名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        /// <param name="teamMemberParams">班组成员参数模型集</param>
        [HttpPost]
        [WrapPostParameters]
        public void CreateTeam(string teamNo, string teamName, Guid? facilityId, string description, IEnumerable<TeamMemberParam> teamMemberParams)
        {
            this._resourceContract.CreateTeam(teamNo, teamName, facilityId, description, teamMemberParams);
        }
        #endregion

        #region # 修改班组 —— void UpdateTeam(Guid teamId, string teamNo...
        /// <summary>
        /// 修改班组
        /// </summary>
        /// <param name="teamId">班组Id</param>
        /// <param name="teamNo">班组编号</param>
        /// <param name="teamName">班组名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        /// <param name="teamMemberParams">班组成员参数模型集</param>
        [HttpPost]
        [WrapPostParameters]
        public void UpdateTeam(Guid teamId, string teamNo, string teamName, Guid? facilityId, string description, IEnumerable<TeamMemberParam> teamMemberParams)
        {
            this._resourceContract.UpdateTeam(teamId, teamNo, teamName, facilityId, description, teamMemberParams);
        }
        #endregion

        #region # 删除班组 —— void RemoveTeam(Guid teamId)
        /// <summary>
        /// 删除班组
        /// </summary>
        /// <param name="teamId">班组Id</param>
        [HttpPost]
        [WrapPostParameters]
        public void RemoveTeam(Guid teamId)
        {
            this._resourceContract.RemoveTeam(teamId);
        }
        #endregion

        #region # 创建设备类 —— void CreateEquipmentClass(Guid? parentNodeId, string classNo...
        /// <summary>
        /// 创建设备类
        /// </summary>
        /// <param name="parentNodeId">上级节点Id</param>
        /// <param name="classNo">设备类编号</param>
        /// <param name="className">设备类名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void CreateEquipmentClass(Guid? parentNodeId, string classNo, string className, Guid? facilityId, string description)
        {
            this._resourceContract.CreateEquipmentClass(parentNodeId, classNo, className, facilityId, description);
        }
        #endregion

        #region # 修改设备类 —— void UpdateEquipmentClass(Guid equipmentClassId, string classNo...
        /// <summary>
        /// 修改设备类
        /// </summary>
        /// <param name="equipmentClassId">设备类Id</param>
        /// <param name="classNo">设备类编号</param>
        /// <param name="className">设备类名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void UpdateEquipmentClass(Guid equipmentClassId, string classNo, string className, Guid? facilityId, string description)
        {
            this._resourceContract.UpdateEquipmentClass(equipmentClassId, classNo, className, facilityId, description);
        }
        #endregion

        #region # 删除设备类 —— void RemoveEquipmentClass(Guid equipmentClassId)
        /// <summary>
        /// 删除设备类
        /// </summary>
        /// <param name="equipmentClassId">设备类Id</param>
        [HttpPost]
        [WrapPostParameters]
        public void RemoveEquipmentClass(Guid equipmentClassId)
        {
            this._resourceContract.RemoveEquipmentClass(equipmentClassId);
        }
        #endregion

        #region # 创建设备 —— void CreateEquipment(string equipmentNo, string equipmentName...
        /// <summary>
        /// 创建设备
        /// </summary>
        /// <param name="equipmentNo">设备编号</param>
        /// <param name="equipmentName">设备名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void CreateEquipment(string equipmentNo, string equipmentName, Guid? facilityId, string description)
        {
            this._resourceContract.CreateEquipment(equipmentNo, equipmentName, facilityId, description);
        }
        #endregion

        #region # 修改设备 —— void UpdateEquipment(Guid equipmentId, string equipmentNo...
        /// <summary>
        /// 修改设备
        /// </summary>
        /// <param name="equipmentId">设备Id</param>
        /// <param name="equipmentNo">设备编号</param>
        /// <param name="equipmentName">设备名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void UpdateEquipment(Guid equipmentId, string equipmentNo, string equipmentName, Guid? facilityId, string description)
        {
            this._resourceContract.UpdateEquipment(equipmentId, equipmentNo, equipmentName, facilityId, description);
        }
        #endregion

        #region # 删除设备 —— void RemoveEquipment(Guid equipmentId)
        /// <summary>
        /// 删除设备
        /// </summary>
        /// <param name="equipmentId">设备Id</param>
        [HttpPost]
        [WrapPostParameters]
        public void RemoveEquipment(Guid equipmentId)
        {
            this._resourceContract.RemoveEquipment(equipmentId);
        }
        #endregion

        #region # 关联设备到设备类 —— void RelateEquipmentToClasses(Guid equipmentId...
        /// <summary>
        /// 关联设备到设备类
        /// </summary>
        /// <param name="equipmentId">设备Id</param>
        /// <param name="equipmentClassIds">设备类Id集</param>
        [HttpPost]
        [WrapPostParameters]
        public void RelateEquipmentToClasses(Guid equipmentId, IEnumerable<Guid> equipmentClassIds)
        {
            this._resourceContract.RelateEquipmentToClasses(equipmentId, equipmentClassIds);
        }
        #endregion

        #region # 创建物料类 —— void CreateMaterialClass(Guid? parentNodeId, string classNo...
        /// <summary>
        /// 创建物料类
        /// </summary>
        /// <param name="parentNodeId">上级节点Id</param>
        /// <param name="classNo">物料类编号</param>
        /// <param name="className">物料类名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="materialSourceType">物料来源类型</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void CreateMaterialClass(Guid? parentNodeId, string classNo, string className, Guid? facilityId, MaterialSourceType? materialSourceType, string description)
        {
            this._resourceContract.CreateMaterialClass(parentNodeId, classNo, className, facilityId, materialSourceType, description);
        }
        #endregion

        #region # 修改物料类 —— void UpdateMaterialClass(Guid materialClassId, string classNo...
        /// <summary>
        /// 修改物料类
        /// </summary>
        /// <param name="materialClassId">物料类Id</param>
        /// <param name="classNo">物料类编号</param>
        /// <param name="className">物料类名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="materialSourceType">物料来源类型</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void UpdateMaterialClass(Guid materialClassId, string classNo, string className, Guid? facilityId, MaterialSourceType? materialSourceType, string description)
        {
            this._resourceContract.UpdateMaterialClass(materialClassId, classNo, className, facilityId, materialSourceType, description);
        }
        #endregion

        #region # 删除物料类 —— void RemoveMaterialClass(Guid materialClassId)
        /// <summary>
        /// 删除物料类
        /// </summary>
        /// <param name="materialClassId">物料类Id</param>
        [HttpPost]
        [WrapPostParameters]
        public void RemoveMaterialClass(Guid materialClassId)
        {
            this._resourceContract.RemoveMaterialClass(materialClassId);
        }
        #endregion

        #region # 创建物料定义 —— Guid CreateMaterial(string materialNo, string materialName...
        /// <summary>
        /// 创建物料定义
        /// </summary>
        /// <param name="materialNo">物料定义编号</param>
        /// <param name="materialName">物料定义名称</param>
        /// <param name="erpNo">ERP编号</param>
        /// <param name="standardUnitNo">基准单位编号</param>
        /// <param name="specification">规格</param>
        /// <param name="guaranteePeriod">保质期</param>
        /// <param name="materialSourceType">物料来源类型</param>
        /// <param name="hasLot">是否按批量管理</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="dataSource">数据来源</param>
        /// <param name="description">描述</param>
        /// <returns>物料定义Id</returns>
        [HttpPost]
        [WrapPostParameters]
        public Guid CreateMaterial(string materialNo, string materialName, string erpNo, string standardUnitNo, string specification, TimeSpan guaranteePeriod, MaterialSourceType? materialSourceType, bool hasLot, Guid? facilityId, string dataSource, string description)
        {
            return this._resourceContract.CreateMaterial(materialNo, materialName, erpNo, standardUnitNo, specification, guaranteePeriod, materialSourceType, hasLot, facilityId, dataSource, description);
        }
        #endregion

        #region # 修改物料定义 —— void UpdateMaterial(Guid materialId, string materialNo...
        /// <summary>
        /// 修改物料定义
        /// </summary>
        /// <param name="materialId">物料定义Id</param>
        /// <param name="materialNo">物料定义编号</param>
        /// <param name="materialName">物料定义名称</param>
        /// <param name="erpNo">ERP编号</param>
        /// <param name="standardUnitNo">基准单位编号</param>
        /// <param name="specification">规格</param>
        /// <param name="guaranteePeriod">保质期</param>
        /// <param name="materialSourceType">物料来源类型</param>
        /// <param name="hasLot">是否按批量管理</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="dataSource">数据来源</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void UpdateMaterial(Guid materialId, string materialNo, string materialName, string erpNo, string standardUnitNo, string specification, TimeSpan guaranteePeriod, MaterialSourceType? materialSourceType, bool hasLot, Guid? facilityId, string dataSource, string description)
        {
            this._resourceContract.UpdateMaterial(materialId, materialNo, materialName, erpNo, standardUnitNo, specification, guaranteePeriod, materialSourceType, hasLot, facilityId, dataSource, description);
        }
        #endregion

        #region # 删除物料定义 —— void RemoveMaterial(Guid materialId)
        /// <summary>
        /// 删除物料定义
        /// </summary>
        /// <param name="materialId">物料定义Id</param>
        [HttpPost]
        [WrapPostParameters]
        public void RemoveMaterial(Guid materialId)
        {
            this._resourceContract.RemoveMaterial(materialId);
        }
        #endregion

        #region # 设置物料包装 —— void SetMaterialPack(Guid materialId...
        /// <summary>
        /// 设置物料包装
        /// </summary>
        /// <param name="materialId">物料定义Id</param>
        /// <param name="materialPackParam">物料包装参数模型</param>
        [HttpPost]
        [WrapPostParameters]
        public void SetMaterialPack(Guid materialId, MaterialPackParam materialPackParam)
        {
            this._resourceContract.SetMaterialPack(materialId, materialPackParam);
        }
        #endregion

        #region # 设置物料条码设置 —— void SetMaterialPack(Guid materialId...
        /// <summary>
        /// 设置物料条码设置
        /// </summary>
        /// <param name="materialId">物料定义Id</param>
        /// <param name="materialBarcodeSettingParam">物料条码设置参数模型</param>
        [HttpPost]
        [WrapPostParameters]
        public void SetMaterialBarcodeSetting(Guid materialId, MaterialBarcodeSettingParam materialBarcodeSettingParam)
        {
            this._resourceContract.SetMaterialBarcodeSetting(materialId, materialBarcodeSettingParam);
        }
        #endregion

        #region # 关联物料定义到物料类 —— void RelateMaterialToClasses(Guid materialId...
        /// <summary>
        /// 关联物料定义到物料类
        /// </summary>
        /// <param name="materialId">物料定义Id</param>
        /// <param name="materialClassIds">物料类Id集</param>
        [HttpPost]
        [WrapPostParameters]
        public void RelateMaterialToClasses(Guid materialId, IEnumerable<Guid> materialClassIds)
        {
            this._resourceContract.RelateMaterialToClasses(materialId, materialClassIds);
        }
        #endregion

        #region # 启用物料定义 —— void EnableMaterial(Guid materialId)
        /// <summary>
        /// 启用物料定义
        /// </summary>
        /// <param name="materialId">物料定义Id</param>
        [HttpPost]
        [WrapPostParameters]
        public void EnableMaterial(Guid materialId)
        {
            this._resourceContract.EnableMaterial(materialId);
        }
        #endregion

        #region # 停用物料定义 —— void DisableMaterial(Guid materialId...
        /// <summary>
        /// 停用物料定义
        /// </summary>
        /// <param name="materialId">物料定义Id</param>
        /// <param name="reason">停用原因</param>
        [HttpPost]
        [WrapPostParameters]
        public void DisableMaterial(Guid materialId, string reason)
        {
            this._resourceContract.DisableMaterial(materialId, reason);
        }
        #endregion

        #region # 创建企业 —— void CreateEnterprise(string enterpriseNo, string enterpriseName...
        /// <summary>
        /// 创建企业
        /// </summary>
        /// <param name="enterpriseNo">企业编号</param>
        /// <param name="enterpriseName">企业名称</param>
        /// <param name="enterpriseType">企业类型</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="address">联系地址</param>
        /// <param name="phone">联系电话</param>
        /// <param name="contact">联系人</param>
        /// <param name="fax">传真</param>
        /// <param name="legalPerson">法人</param>
        /// <param name="licenseNo">营业执照编号</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void CreateEnterprise(string enterpriseNo, string enterpriseName, EnterpriseType enterpriseType, Guid? facilityId, string address, string phone, string contact, string fax, string legalPerson, string licenseNo, string description)
        {
            this._resourceContract.CreateEnterprise(enterpriseNo, enterpriseName, enterpriseType, facilityId, address, phone, contact, fax, legalPerson, licenseNo, description);
        }
        #endregion

        #region # 修改企业 —— void UpdateEnterprise(Guid enterpriseId, string enterpriseNo...
        /// <summary>
        /// 修改企业
        /// </summary>
        /// <param name="enterpriseId">企业Id</param>
        /// <param name="enterpriseNo">企业编号</param>
        /// <param name="enterpriseName">企业名称</param>
        /// <param name="enterpriseType">企业类型</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="address">联系地址</param>
        /// <param name="phone">联系电话</param>
        /// <param name="contact">联系人</param>
        /// <param name="fax">传真</param>
        /// <param name="legalPerson">法人</param>
        /// <param name="licenseNo">营业执照编号</param>
        /// <param name="description">描述</param>
        [HttpPost]
        [WrapPostParameters]
        public void UpdateEnterprise(Guid enterpriseId, string enterpriseNo, string enterpriseName, EnterpriseType enterpriseType, Guid? facilityId, string address, string phone, string contact, string fax, string legalPerson, string licenseNo, string description)
        {
            this._resourceContract.UpdateEnterprise(enterpriseId, enterpriseNo, enterpriseName, enterpriseType, facilityId, address, phone, contact, fax, legalPerson, licenseNo, description);
        }
        #endregion

        #region # 删除企业 —— void RemoveEnterprise(Guid enterpriseId)
        /// <summary>
        /// 删除企业
        /// </summary>
        /// <param name="enterpriseId">企业Id</param>
        [HttpPost]
        [WrapPostParameters]
        public void RemoveEnterprise(Guid enterpriseId)
        {
            this._resourceContract.RemoveEnterprise(enterpriseId);
        }
        #endregion


        //查询部分

        #region # 获取人员类列表 —— IEnumerable<PersonClassInfo> GetPersonClasses(string keywords...
        /// <summary>
        /// 获取人员类列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="parentNodeId">上级节点Id</param>
        /// <returns>人员类列表</returns>
        [HttpGet]
        public IEnumerable<PersonClassInfo> GetPersonClasses(string keywords, Guid? facilityId, Guid? parentNodeId)
        {
            return this._resourceContract.GetPersonClasses(keywords, facilityId, parentNodeId);
        }
        #endregion

        #region # 获取根级人员类列表 —— IEnumerable<PersonClassInfo> GetRootPersonClasses()
        /// <summary>
        /// 获取根级人员类列表
        /// </summary>
        /// <returns>人员类列表</returns>
        [HttpGet]
        public IEnumerable<PersonClassInfo> GetRootPersonClasses()
        {
            return this._resourceContract.GetRootPersonClasses();
        }
        #endregion

        #region # 根据Id获取人员类字典 —— IDictionary<Guid, PersonClassInfo> GetPersonClassesById(...
        /// <summary>
        /// 根据Id获取人员类字典
        /// </summary>
        /// <param name="personClassIds">人员类Id集</param>
        /// <returns>人员类字典</returns>
        [HttpGet]
        public IDictionary<Guid, PersonClassInfo> GetPersonClassesById([FromJson] IEnumerable<Guid> personClassIds)
        {
            return this._resourceContract.GetPersonClassesById(personClassIds);
        }
        #endregion

        #region # 分页获取人员列表 —— PageModel<PersonInfo> GetPersonsByPage(string keywords...
        /// <summary>
        /// 分页获取人员列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="personClassId">人员类Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <returns>人员列表</returns>
        [HttpGet]
        public PageModel<PersonInfo> GetPersonsByPage(string keywords, Guid? facilityId, Guid? personClassId, int pageIndex, int pageSize)
        {
            return this._resourceContract.GetPersonsByPage(keywords, facilityId, personClassId, pageIndex, pageSize);
        }
        #endregion

        #region # 根据Id获取人员字典 —— {Guid, PersonInfo} GetPersonsById(IEnumerable<Guid> personIds)
        /// <summary>
        /// 根据Id获取人员字典
        /// </summary>
        /// <param name="personIds">人员Id集</param>
        /// <returns>人员字典</returns>
        [HttpGet]
        public IDictionary<Guid, PersonInfo> GetPersonsById([FromJson] IEnumerable<Guid> personIds)
        {
            return this._resourceContract.GetPersonsById(personIds);
        }
        #endregion

        #region # 分页获取班组列表 —— PageModel<TeamInfo> GetTeamsByPage(string keywords...
        /// <summary>
        /// 分页获取班组列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <returns>班组列表</returns>
        [HttpGet]
        public PageModel<TeamInfo> GetTeamsByPage(string keywords, Guid? facilityId, int pageIndex, int pageSize)
        {
            return this._resourceContract.GetTeamsByPage(keywords, facilityId, pageIndex, pageSize);
        }
        #endregion

        #region # 获取班组成员列表 —— IEnumerable<TeamMemberInfo> GetTeamMembers(Guid teamId)
        /// <summary>
        /// 获取班组成员列表
        /// </summary>
        /// <param name="teamId">班组Id</param>
        /// <returns>班组成员列表</returns>
        [HttpGet]
        public IEnumerable<TeamMemberInfo> GetTeamMembers(Guid teamId)
        {
            return this._resourceContract.GetTeamMembers(teamId);
        }
        #endregion

        #region # 获取设备类列表 —— IEnumerable<EquipmentClassInfo> GetEquipmentClasses(string keywords...
        /// <summary>
        /// 获取设备类列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="parentNodeId">上级节点Id</param>
        /// <returns>设备类列表</returns>
        [HttpGet]
        public IEnumerable<EquipmentClassInfo> GetEquipmentClasses(string keywords, Guid? facilityId, Guid? parentNodeId)
        {
            return this._resourceContract.GetEquipmentClasses(keywords, facilityId, parentNodeId);
        }
        #endregion

        #region # 获取根级设备类列表 —— IEnumerable<EquipmentClassInfo> GetRootEquipmentClasses()
        /// <summary>
        /// 获取根级设备类列表
        /// </summary>
        /// <returns>设备类列表</returns>
        [HttpGet]
        public IEnumerable<EquipmentClassInfo> GetRootEquipmentClasses()
        {
            return this._resourceContract.GetRootEquipmentClasses();
        }
        #endregion

        #region # 根据Id获取设备类字典 —— IDictionary<Guid, EquipmentClassInfo> GetEquipmentClassesById(...
        /// <summary>
        /// 根据Id获取设备类字典
        /// </summary>
        /// <param name="equipmentClassIds">设备类Id集</param>
        /// <returns>设备类字典</returns>
        [HttpGet]
        public IDictionary<Guid, EquipmentClassInfo> GetEquipmentClassesById([FromJson] IEnumerable<Guid> equipmentClassIds)
        {
            return this._resourceContract.GetEquipmentClassesById(equipmentClassIds);
        }
        #endregion

        #region # 分页获取设备列表 —— PageModel<EquipmentInfo> GetEquipmentsByPage(string keywords...
        /// <summary>
        /// 分页获取设备列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="equipmentClassId">设备类Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <returns>设备列表</returns>
        [HttpGet]
        public PageModel<EquipmentInfo> GetEquipmentsByPage(string keywords, Guid? facilityId, Guid? equipmentClassId, int pageIndex, int pageSize)
        {
            return this._resourceContract.GetEquipmentsByPage(keywords, facilityId, equipmentClassId, pageIndex, pageSize);
        }
        #endregion

        #region # 根据Id获取设备字典 —— {Guid, EquipmentInfo} GetEquipmentsById(IEnumerable<Guid> equipmentIds)
        /// <summary>
        /// 根据Id获取设备字典
        /// </summary>
        /// <param name="equipmentIds">设备Id集</param>
        /// <returns>设备字典</returns>
        [HttpGet]
        public IDictionary<Guid, EquipmentInfo> GetEquipmentsById([FromJson] IEnumerable<Guid> equipmentIds)
        {
            return this._resourceContract.GetEquipmentsById(equipmentIds);
        }
        #endregion

        #region # 获取物料类列表 —— IEnumerable<MaterialClassInfo> GetMaterialClasses(string keywords...
        /// <summary>
        /// 获取物料类列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="materialSourceType">物料来源类型</param>
        /// <param name="parentNodeId">上级节点Id</param>
        /// <returns>物料类列表</returns>
        [HttpGet]
        public IEnumerable<MaterialClassInfo> GetMaterialClasses(string keywords, Guid? facilityId, MaterialSourceType? materialSourceType, Guid? parentNodeId)
        {
            return this._resourceContract.GetMaterialClasses(keywords, facilityId, materialSourceType, parentNodeId);
        }
        #endregion

        #region # 获取根级物料类列表 —— IEnumerable<MaterialClassInfo> GetRootMaterialClasses()
        /// <summary>
        /// 获取根级物料类列表
        /// </summary>
        /// <returns>物料类列表</returns>
        [HttpGet]
        public IEnumerable<MaterialClassInfo> GetRootMaterialClasses()
        {
            return this._resourceContract.GetRootMaterialClasses();
        }
        #endregion

        #region # 根据Id获取物料类字典 —— IDictionary<Guid, MaterialClassInfo> GetMaterialClassesById(...
        /// <summary>
        /// 根据Id获取物料类字典
        /// </summary>
        /// <param name="materialClassIds">物料类Id集</param>
        /// <returns>物料类字典</returns>
        [HttpGet]
        public IDictionary<Guid, MaterialClassInfo> GetMaterialClassesById([FromJson] IEnumerable<Guid> materialClassIds)
        {
            return this._resourceContract.GetMaterialClassesById(materialClassIds);
        }
        #endregion

        #region # 分页获取物料定义列表 —— PageModel<MaterialInfo> GetMaterialsByPage(string keywords...
        /// <summary>
        /// 分页获取物料定义列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="materialSourceType">物料来源类型</param> 
        /// <param name="hasLot">是否按批量管理</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="enabled">是否启用</param>
        /// <param name="materialClassId">物料类Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <returns>物料定义列表</returns>
        [HttpGet]
        public PageModel<MaterialInfo> GetMaterialsByPage(string keywords, MaterialSourceType? materialSourceType, bool? hasLot, Guid? facilityId, bool? enabled, Guid? materialClassId, int pageIndex, int pageSize)
        {
            return this._resourceContract.GetMaterialsByPage(keywords, materialSourceType, hasLot, facilityId, enabled, materialClassId, pageIndex, pageSize);
        }
        #endregion

        #region # 根据Id获取物料定义字典 —— {Guid, MaterialInfo} GetMaterialsById(IEnumerable<Guid> materialIds)
        /// <summary>
        /// 根据Id获取物料定义字典
        /// </summary>
        /// <param name="materialIds">物料定义Id集</param>
        /// <returns>物料定义字典</returns>
        [HttpGet]
        public IDictionary<Guid, MaterialInfo> GetMaterialsById([FromJson] IEnumerable<Guid> materialIds)
        {
            return this._resourceContract.GetMaterialsById(materialIds);
        }
        #endregion

        #region # 根据编号获取物料定义 —— MaterialInfo GetMaterialByNo(string materialNo)
        /// <summary>
        /// 根据编号获取物料定义
        /// </summary>
        /// <param name="materialNo">物料定义编号</param>
        /// <returns>物料定义</returns>
        [HttpGet]
        public MaterialInfo GetMaterialByNo(string materialNo)
        {
            return this._resourceContract.GetMaterialByNo(materialNo);
        }
        #endregion

        #region # 是否存在物料定义编号 —— bool ExistMaterialNo(Guid? materialId, string materialNo)
        /// <summary>
        /// 是否存在物料定义编号
        /// </summary>
        /// <param name="materialId">物料定义Id</param>
        /// <param name="materialNo">物料定义编号</param>
        /// <returns>是否存在</returns>
        [HttpGet]
        public bool ExistMaterialNo(Guid? materialId, string materialNo)
        {
            return this._resourceContract.ExistMaterialNo(materialId, materialNo);
        }
        #endregion

        #region # 分页获取企业列表 —— PageModel<EnterpriseInfo> GetEnterprisesByPage(string keywords...
        /// <summary>
        /// 分页获取企业列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="enterpriseType">企业类型</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <returns>企业列表</returns>
        [HttpGet]
        public PageModel<EnterpriseInfo> GetEnterprisesByPage(string keywords, EnterpriseType? enterpriseType, Guid? facilityId, int pageIndex, int pageSize)
        {
            return this._resourceContract.GetEnterprisesByPage(keywords, enterpriseType, facilityId, pageIndex, pageSize);
        }
        #endregion
    }
}
